// Source File Name:   ExceptionTable.java

package com.vhly.classfile;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

public class ExceptionTable {

    private int start_pc;
    private int end_pc;
    private int handler_pc;
    private int catch_type;

    public ExceptionTable() {
        start_pc = 0;
        end_pc = 0;
        handler_pc = 0;
        catch_type = 0;
    }

    public void read(DataInputStream datainputstream)
            throws IOException {
        start_pc = datainputstream.readUnsignedShort();
        end_pc = datainputstream.readUnsignedShort();
        handler_pc = datainputstream.readUnsignedShort();
        catch_type = datainputstream.readUnsignedShort();
    }

    public void write(DataOutputStream dataoutputstream)
            throws IOException {
        dataoutputstream.writeShort(start_pc);
        dataoutputstream.writeShort(end_pc);
        dataoutputstream.writeShort(handler_pc);
        dataoutputstream.writeShort(catch_type);
    }

    public int getStartPC() {
        return start_pc;
    }

    public void setStartPC(int spc) {
        start_pc = spc;
    }

    public int getEndPC() {
        return end_pc;
    }

    public void setEndPC(int epc) {
        end_pc = epc;
    }

    public int getHandlerPC() {
        return handler_pc;
    }

    public void setHandlerPC(int hpc) {
        handler_pc = hpc;
    }

    public int getCatchType() {
        return catch_type;
    }

    public void setCatchType(int ct) {
        catch_type = ct;
    }
}